Skip to content

Some Engineer logics on Warheads - #1801

Open
FS-21 wants to merge 20 commits into
Phobos-developers:developfrom
FS-21:feature/EngineerLogicsOnWarheads
Open

Some Engineer logics on Warheads#1801
FS-21 wants to merge 20 commits into
Phobos-developers:developfrom
FS-21:feature/EngineerLogicsOnWarheads

Conversation

@FS-21

@FS-21 FS-21 commented Aug 7, 2025

Copy link
Copy Markdown
Contributor

Engineer logics on Warheads

  • Now any InfantryType, VehicleType, BuildingType or AircraftType can execute some operations engineers do without loosing the firer in the process.
  • FakeEngineer.CanRepairBridges, if set to true, when a building with BridgeRepairHut=yes linked to a bridge is affected by the Warhead then all destroyed bridge sections will be fixed.
  • FakeEngineer.CanDestroyBridges, if set to true, when a building with BridgeRepairHut=yes linked to a bridge is affected by the Warhead then all the bridge will be destroyed.
  • FakeEngineer.CanCaptureBuildings, if set to true, a building with Capturable=true or NeedsEngineer=true is affected by the Warhead then the building will be captured by the house's firer.
  • FakeEngineer.DisarmBombs, if set to true, an attached bomb will be removed if the target is affected by the Warhead.

In rulesmd.ini:

[SOMEWARHEAD]                          ; WarheadType
FakeEngineer.CanRepairBridges=false    ; boolean
FakeEngineer.CanDestroyBridges=false   ; boolean
FakeEngineer.CanCaptureBuildings=false ; boolean
FakeEngineer.DisarmBombs=false         ; boolean

Regarding "Forcing specific weapon against certain targets":

  • ForceWeapon.Capture forces specified weapon to be used if the target building is capturable.

In rulesmd.ini:

[SOMETECHNO]   
ForceWeapon.Capture=-1     ; integer, -1 to disable

FS-21 added 12 commits July 25, 2025 18:10
- Now `infantry` and `units` can execute some operations engineers do without loosing the firer like happens with engineers.
- `FakeEngineer.CanRepairBridges`, if set to true, when a building with `BridgeRepairHut=yes` linked to a bridge is affected by the Warhead then all destroyed bridge sections will be fixed.
- `FakeEngineer.CanDestroyBridges`, if set to true, when a building with `BridgeRepairHut=yes` linked to a bridge is affected by the Warhead then all the bridge will be destroyed.
- `FakeEngineer.CanCaptureBuildings`, if set to true, a building with `Capturable=true` or `NeedsEngineer=true` is affected by the Warhead then the building will be captured by the house's firer.

In `rulesmd.ini`:
```ini
[SOMEWARHEAD]                          ; WarheadType
FakeEngineer.CanRepairBridges=false    ; boolean
FakeEngineer.CanDestroyBridges=false   ; boolean
FakeEngineer.CanCaptureBuildings=false ; boolean
```
Removed all repetitive code related to checks and placed all that in a new method called CanBeAffectedByFakeEngineer(...)
Found a silent crash. Code tweaks
- Added ForceWeapon.Capture.
- Added FakeEngineer.BombDisarm.
- Code cleanup and improvements.
@FS-21

FS-21 commented Aug 7, 2025

Copy link
Copy Markdown
Contributor Author

Example of a soldier using multiweapons with these tags in warheads:
CABAL_Engineer_new_changes_01

@github-actions

github-actions Bot commented Aug 7, 2025

Copy link
Copy Markdown

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@NetsuNegi

Copy link
Copy Markdown
Contributor

warhead has its own BombDisarm, why do you add FakeEngineer.DisarmBombs ?

@fagonghaiwo

Copy link
Copy Markdown

FakeEngineer.DisarmBombs & FakeEngineer.CanDestroyBridges dont work

FS-21 added 2 commits August 12, 2025 08:24
and code improvements like adding the "send event" in the capture building, because I think the radar event the capture function has doesn't trigger the Enter event in map triggers.
Also, now can be triggered both repair bridge & destroy bridge depending of the current bridge status if both tags are enabled in the warhead.
@FS-21

FS-21 commented Aug 12, 2025

Copy link
Copy Markdown
Contributor Author

warhead has its own BombDisarm, why do you add FakeEngineer.DisarmBombs ?

Vanilla tag "BombDisarm" makes the wapon unusable for other purposes that isn't defuse bombs, also disrupts the weapons selection if you try to use the multiweapons and that tag isn't in the last weapon of the multiweapon list.
If you use a repairer unit against a damaged unit with an attached bomb say "bye, bye!" to that unit because you won't be able to trigger the BombDisarm weapon with enough time because the unit is being repaired by another weapon.

Try yourself if you aren't sure of my findings (I could be wrong) :-)

@FS-21

FS-21 commented Aug 12, 2025

Copy link
Copy Markdown
Contributor Author

FakeEngineer.DisarmBombs & FakeEngineer.CanDestroyBridges dont work

You are right about the FakeEngineer.CanDestroyBridges, I broke it days before I started this PR, I'm sorry. Now is fixed. You can have both repair & destroy tags in the same warhead and the bridge will be repaired or destroyed depending the current status of the bridge.
FakeEngineer.DisarmBombs is more "companion" of another WH's weapon.

As I mentioned to NetsuNegi I used this new disarm bombs tag in a repair weapon inside a multiweapon in a combat engineer with this weapons order:
1º) Offensive weapon (limited to attack enemies)
2º) Capture & Repair bridge weapon (limited to enemies)
3º) Repair weapon (limited to friendly and until the damaged reachs a 99% of the health, because I use the AttackFriendlies=yes for auto-targeting friendly stuff, including buildings and I had to restrict the continuous repairs to objects with <100% of health. Also this repair weapon includes the FakeEngineer.DisarmBombs for disarm bombs while is doing repairs).
4º) Last weapon with the classic DisarmBombs=yes in the warhead for other cases.

@fagonghaiwo

Copy link
Copy Markdown

when FakeEngineer.CanDestroyBridges=1 & FakeEngineer.CanRepairBridges=1 in a same warhead, bridge cant be repaired or destroyed

@FS-21

FS-21 commented Aug 12, 2025

Copy link
Copy Markdown
Contributor Author

when FakeEngineer.CanDestroyBridges=1 & FakeEngineer.CanRepairBridges=1 in a same warhead, bridge cant be repaired or destroyed

; general multiple small arms fire
[SA]
Verses=100%,80%,80%,25%,13%,13%,38%,25%,13%,100%,100%
InfDeath=1
AnimList=PIFFPIFF,PIFFPIFF
Bullets=yes
ProneDamage=70%
Tiberium=no
FakeEngineer.CanRepairBridges=true
FakeEngineer.CanDestroyBridges=true
fake engineer logic vs bridges 01

@fagonghaiwo

Copy link
Copy Markdown

bandicam 2025-08-12 19-33-24-499
sad
[FlakGuyATWH]
Versus.bridge=3%
FakeEngineer.CanRepairBridges=1 ; boolean
FakeEngineer.CanDestroyBridges=1 ; boolean
FakeEngineer.CanCaptureBuildings=1 ; boolean
FakeEngineer.DisarmBombs=1 ; boolean

@fagonghaiwo

Copy link
Copy Markdown

bandicam 2025-08-12 19-35-48-152
neither repair

@fagonghaiwo

Copy link
Copy Markdown

bandicam 2025-08-13 01-25-45-111
sad again

@fagonghaiwo

Copy link
Copy Markdown

after update, FakeEngineer.CanRepairBridges can repair bridges which are NOT broken.

FakeEngineer.DisarmBombs still doesnt work.

@TaranDahl TaranDahl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too many problems. I think the author lacks the necessary understanding of the unit's firing procedure.

Comment thread src/Ext/Techno/Hooks.ReceiveDamage.cpp Outdated
Comment thread src/Ext/Techno/Body.cpp Outdated
Comment thread src/Ext/Techno/Body.cpp Outdated
Comment thread src/Ext/Techno/Hooks.ReceiveDamage.cpp
// Send engineer's "enter" event
auto const pTag = pBuilding->AttachedTag;
if (args->Attacker && pTag)
pTag->RaiseEvent(TriggerEvent::EnteredBy, args->Attacker, CellStruct::Empty);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is unreasonable because nothing has entered the target.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should raise DestroyedByAnything

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding raising TriggerEvent::EnteredBy instead of DestroyedByAnything (or omitting it):

If I'm not wrong in RA2 and YR map scripting (both original campaign missions and custom community maps), mappers use the trigger event Entered By... (Trigger Event 1) on neutral Tech Buildings, mission-critical structures, and Bridge Repair Huts to detect when an engineer captures the building or repairs the bridge.

Since entering the structure was vanilla's only way for an engineer to capture buildings or trigger bridge repairs, EnteredBy serves as the de-facto event hook for map scripts to advance mission objectives (e.g., "Capture Tech Hospital -> Entered by Player -> Objective Completed / Reveal Area").

If we do not raise EnteredBy: Any map trigger expecting the structure to be captured by an engineer will never trigger, breaking campaign progression and custom map scripts.
If we were to raise DestroyedByAnything on capture: It would break missions that have fail conditions like "Protect this structure (Fail if DestroyedByAnybody)", causing an immediate Mission Failed upon capturing the building instead of securing it.
Therefore, raising TriggerEvent::EnteredBy is intentional and necessary to maintain full compatibility with existing map scripts and trigger systems when capturing structures or repairing bridge huts remotely via warheads.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do not raise EnteredBy: Any map trigger expecting the structure to be captured by an engineer will never trigger, breaking campaign progression and custom map scripts.

Why would an unmerged feature break anything? It doesn't modify any vanilla behavior.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because is supposed to be used by support units like engineers/saboteurs and those doesn'tdestroy, they capture. I can't imagine these tags in standard units.

Comment thread src/Ext/Techno/Hooks.TargetEvaluation.cpp Outdated
Comment thread src/Ext/TechnoType/Body.cpp Outdated
Comment thread src/Ext/Techno/Body.cpp Outdated
Comment thread src/Ext/Techno/Hooks.ReceiveDamage.cpp
Comment thread src/Ext/Techno/Hooks.TargetEvaluation.cpp Outdated
@TaranDahl TaranDahl added the Needs rework The structure or methodology is "mise en question" label Jan 12, 2026
@TaranDahl TaranDahl added ⚙️T1 T1 maintainer review is sufficient ❓Unhardcoding / Customization Make something more tweakable labels Jan 12, 2026
@FS-21

FS-21 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

I applied feedback and small changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs rework The structure or methodology is "mise en question" ⚙️T1 T1 maintainer review is sufficient ❓Unhardcoding / Customization Make something more tweakable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants